package com.lyf.viewapp.other;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.lyf.viewapp.R;
import com.lyf.viewapp.chart.PieChartActivity;
import com.lyf.viewapp.other.konfetti.KonfettiActivity;
import com.lyf.viewapp.other.spotlight.SpotlightActivity;
import com.lyf.viewapp.util.EnterAdapter;
import com.lyf.viewapp.util.EnterBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 其他内容
 * @author lyf
 */
public class OtherMainActivity extends AppCompatActivity {

    @BindView(R.id.other_listView)
    ListView otherListView;
    private List<EnterBean> list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_other_main);
        ButterKnife.bind(this);

        list = new ArrayList<>();
        initDate();

    }

    private void initDate() {
        list.add(new EnterBean("Konfetti", KonfettiActivity.class));
        list.add(new EnterBean("Spotlight", SpotlightActivity.class));

        EnterAdapter ada = new EnterAdapter(this, list);
        otherListView.setAdapter(ada);
        otherListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent(OtherMainActivity.this, list.get(position).getActivity());
                startActivity(intent);
            }
        });
    }
}
